<?php

namespace app\admin\controller;

use think\facade\App;

class Domain extends Base {
    
    /**
     * @desc 域名列表
     */
    public function index() {
        $params['domainName'] = input('domainName');
        $params['status']     = input('status');
        $params['userName']   = input('userName', '', 'trim');
        
        $logic = App::model('Domain', 'logic');
        $data = $logic->index($params);
        
        $this->assign($data);
        return view();
    }
    
    
    /**
     * @desc 确认处理
     */
    public function confirm() {
        $params['id']       = input('id');
        $params['memberId'] = $this->memberId;
        
        $logic = model('Domain', 'logic');
        $data = [];
        try {
            $data = $logic->confirm($params);
        } catch (\Exception $e) {
            $logic->errorCode = EC_FAILURE;
            $logic->message = $e->getMessage();
        }
        return send_response($data, $logic->errorCode, $logic->message);
    }
    
    /**
     * @desc 域名详情
     */
    public function detail() {
        $params['id']   = input('id');
        
        $logic = App::model('Domain', 'logic');
        $data = $logic->detail($params);
        
        $this->assign($data);
        return view();
    }
}
